package com.wd.jdbc;

import java.sql.Connection;

import javax.sql.DataSource;

import org.springframework.stereotype.Component;

import com.wd.core.spring.support.SpringUtils;

@Component
public class AbstractService {

	public static Connection getConnection() throws Exception {

		DataSource ds = (DataSource) SpringUtils.getBean("dataSource");
		return ds.getConnection();
	}

	public static void CloseConnection(Connection con) {

		if (con != null)
			try {
				con.close();
			} catch (Exception ignore) {
			}
	}
}
